<% define_content :link do %>
  <%= course_url data.course_id %>
<% end %>
<% define_content :subject do %>
  <%= t('subject', 'Alert: %{user_name}', :user_name => data.student_name) %>
<% end %>

<%=
  if data.user_id == user.id
    t('body_student', {:one => "An alert has been triggered for you because the following condition has been met:", :other => "An alert has been triggered for you because the following conditions have been met:"}, :count => asset.criteria.length)
  else
    t('body', {:one => "An alert has been triggered for %{student} because the following condition has been met:", :other => "An alert has been triggered for %{student} because the following conditions have been met:"}, :count => asset.criteria.length, :student => data.student_name)
  end
%>
<% asset.criteria.each do |criterion| %>
  <%=
    case criterion.criterion_type
    when 'Interaction'
      t('interaction_description', 'No student/teacher interaction for %{count} days', :count => n(criterion.threshold))
    when 'UngradedCount'
      t('ungraded_count_description', '%{count} or more submissions have not been graded', :count => n(criterion.threshold))
    when 'UngradedTimespan'
      t('ungraded_timespan_description', 'A submission has been left ungraded for %{count} days', :count => n(criterion.threshold))
    when 'UserNote'
      t('usernote_description', 'No faculty journal entries for %{count} days', :count => n(criterion.threshold))
    end
  %>
<% end %>

<%= content :link %>
